package cn.iocoder.yudao.module.biz.dal.mysql.bizsalesteam;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.controller.admin.salesteam.vo.BizSalesTeamPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.bizsalesteam.BizSalesTeamDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 销售团队信息 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface BizSalesTeamMapper extends BaseMapperX<BizSalesTeamDO> {

    default PageResult<BizSalesTeamDO> selectPage(BizSalesTeamPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizSalesTeamDO>()
                .likeIfPresent(BizSalesTeamDO::getTeamName, reqVO.getTeamName())
                .eqIfPresent(BizSalesTeamDO::getTeamCode, reqVO.getTeamCode())
                .eqIfPresent(BizSalesTeamDO::getManagerId, reqVO.getManagerId())
                .eqIfPresent(BizSalesTeamDO::getDepartmentId, reqVO.getDepartmentId())
                .eqIfPresent(BizSalesTeamDO::getTeamGoal, reqVO.getTeamGoal())
                .eqIfPresent(BizSalesTeamDO::getCurrentQuarterTarget, reqVO.getCurrentQuarterTarget())
                .eqIfPresent(BizSalesTeamDO::getTeamDescription, reqVO.getTeamDescription())
                .betweenIfPresent(BizSalesTeamDO::getEstablishmentDate, reqVO.getEstablishmentDate())
                .eqIfPresent(BizSalesTeamDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BizSalesTeamDO::getRegion, reqVO.getRegion())
                .eqIfPresent(BizSalesTeamDO::getContractType, reqVO.getContractType())
                .eqIfPresent(BizSalesTeamDO::getProductFocus, reqVO.getProductFocus())
                .betweenIfPresent(BizSalesTeamDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BizSalesTeamDO::getTeamId));
    }

}